iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 23
0
Cloud

OpenStack-多到數不清的套件改系列 第 29

OpenStack Administrator Compute

  • 分享至 

  • xImage
  •  

主題

OpenStack Administrator Compute

前言

前面有提到說如何更改虛擬機的虛擬化方式
這邊我會寫到比較詳細的內容

主要內容

虛擬化方式

前面有提過我不再重新敘述
參考網站
下面我會把基本的列出,大家可以則幾個使用

KVM

檢查是否支援硬體虛擬化

grep -E 'svm|vmx' /proc/cpuinfo

有輸出就有,反之沒有
1.更改設定檔

sudo vim /etc/nova/nova.conf
compute_driver = libvirt.LibvirtDriver

[libvirt]
virt_type = kvm

2.檢查是否啟用KVM

sudo lsmod | grep kvm

如果沒有顯示請執行下面兩步

sudo modprobe -a kvm

依照自己的CPU品牌進行挑選

Intel
sudo modprobe -a kvm-intel
AMD
modprobe -a kvm-amd

QEMU

1.更改設定檔

sudo vim /etc/nova/nova.conf
compute_driver = libvirt.LibvirtDriver

[libvirt]
virt_type = qemu

2.下載服務驅動

sudo apt-get install guestmount -y

XenServer

1.下載並安裝XenServer
2.編輯設定檔

sudo vim /etc/nova/nova.conf
compute_driver = xenapi.XenAPIDriver
[xenserver]
connection_url = XenServer_IP位置
connection_username = root
connection_password = 密碼

LxC

1.編輯設定檔

sudo vim /etc/nova/nova.conf
compute_driver = libvirt.LibvirtDriver

[libvirt]
virt_type = lxc

Esxi


先來看一下官方配置方法
1.編輯設定檔

sudo vim /etc/nova/nova.conf
[DEFAULT]
compute_driver = vmwareapi.VMwareVCDriver

[vmware]
host_ip = <vCenter hostname or IP address>
host_username = <vCenter username>
host_password = <vCenter password>
cluster_name = <vCenter cluster name>
datastore_regex = <optional datastore regex>

Hyper-V

都是在Windows上做的步驟
1.設定NTP

C:\>net stop w32time
C:\>w32tm /config /manualpeerlist:pool.ntp.org,0x8 /syncfromflags:MANUAL
C:\>net start w32time

2.編輯虛擬交換器

PS C:\> $if = Get-NetIPAddress -IPAddress 192* | Get-NetIPInterface
PS C:\> New-VMSwitch -NetAdapterName $if.ifAlias -Name YOUR_BRIDGE_NAME -AllowManagementOS $false

3.啟用ISCSI

PS C:\> Set-Service -Name MSiSCSI -StartupType Automatic
PS C:\> Start-Service MSiSCSI

4.下載Hyper-V驅動
詳細說明請看這邊
5.安裝Python

PS C:\> $src = "http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi"
PS C:\> $dest = "$env:temp\python-2.7.3.msi"
PS C:\> Invoke-WebRequest –Uri $src –OutFile $dest
PS C:\> Unblock-File $dest
PS C:\> Start-Process $dest

6.建立Python對應

PS C:\> $oldPath = [System.Environment]::GetEnvironmentVariable("Path")
PS C:\> $newPath = $oldPath + ";C:\python27\;C:\python27\Scripts\"
PS C:\> [System.Environment]::SetEnvironmentVariable("Path", $newPath, [System.EnvironmentVariableTarget]::User

7.安裝元件

PS C:\> pip install ecdsa
PS C:\> pip install amqp
PS C:\> pip install wmi

8.下載[Nova-compute]並安裝(https://github.com/msysgit/msysgit/releases/download/Git-1.9.2-preview20140411/Git-1.9.2-preview20140411.exe)
9.安裝Git

PS C:\> $src = "https://github.com/msysgit/msysgit/releases/download/Git-1.9.2-preview20140411/Git-1.9.2-preview20140411.exe"
PS C:\> $dest = "$env:temp\Git-1.9.2-preview20140411.exe"
PS C:\> Invoke-WebRequest –Uri $src –OutFile $dest
PS C:\> Unblock-File $dest
PS C:\> Start-Process $dest

10.下載程式碼

PS C:\> git.exe clone https://git.openstack.org/openstack/nova

11.安裝Nova-compute

PS C:\> cd c:\nova
PS C:\> python setup.py install

12.編輯nova.conf設定檔
IP的地方都要改喔

[DEFAULT]
auth_strategy = keystone
image_service = nova.image.glance.GlanceImageService
compute_driver = nova.virt.hyperv.driver.HyperVDriver
volume_api_class = nova.volume.cinder.API
fake_network = true
instances_path = C:\Program Files (x86)\OpenStack\Instances
glance_api_servers = IP_ADDRESS:9292
use_cow_images = true
force_config_drive = false
injected_network_template = C:\Program Files (x86)\OpenStack\Nova\etc\interfaces.template
policy_file = C:\Program Files (x86)\OpenStack\Nova\etc\policy.json
mkisofs_cmd = C:\Program Files (x86)\OpenStack\Nova\bin\mkisofs.exe
allow_resize_to_same_host = true
running_deleted_instance_action = reap
running_deleted_instance_poll_interval = 120
resize_confirm_window = 5
resume_guests_state_on_host_boot = true
rpc_response_timeout = 1800
lock_path = C:\Program Files (x86)\OpenStack\Log\
rpc_backend = nova.openstack.common.rpc.impl_kombu
rabbit_host = IP_ADDRESS
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = Passw0rd
logdir = C:\Program Files (x86)\OpenStack\Log\
logfile = nova-compute.log
instance_usage_audit = true
instance_usage_audit_period = hour
use_neutron = True
[neutron]
url = http://IP_ADDRESS:9696
auth_strategy = keystone
admin_tenant_name = service
admin_username = neutron
admin_password = Passw0rd
admin_auth_url = http://IP_ADDRESS:35357/v2.0
[hyperv]
vswitch_name = newVSwitch0
limit_cpu_features = false
config_drive_inject_password = false
qemu_img_cmd = C:\Program Files (x86)\OpenStack\Nova\bin\qemu-img.exe
config_drive_cdrom = true
dynamic_memory_ratio = 1
enable_instance_metrics_collection = true
[rdp]
enabled = true
html5_proxy_base_url = https://IP_ADDRESS:4430

13.建立虛擬機
參照Technet
14.建立映像檔

PS C:\> glance image-create --name "VM_IMAGE_NAME" --is-public False \
--container-format bare --disk-format vhd

15.執行

PS C:\> C:\Python27\python.exe c:\Python27\Scripts\nova-compute --config-file c:\etc\nova\nova.conf

Virtuozzo

1.編輯設定檔

sudo vim  /etc/nova/nova.conf

他會有兩種虛擬化方式

container
compute_driver = libvirt.LibvirtDriver
force_raw_images = False

[libvirt]
virt_type = parallels
images_type = ploop
connection_uri = parallels:///system
inject_partition = -2
VM
compute_driver = libvirt.LibvirtDriver

[libvirt]
virt_type = parallels
images_type = qcow2
connection_uri = parallels:///system

後記

今天虛擬化的方式就介紹到這邊
明天將會繼續探討
希望大家可以在這一個月中讀到非常多的應用技巧,那如果有問題可以以私訊我的方式是使用問題回復,我會盡可能地回答問題,那會在後面統一做回覆,或者如果有想知道的相關的應用也可以提出討論喔。

參考資料

OpenStack Doc


上一篇
OpenStack Administrator Guide - Dashboard
下一篇
OpenStack Administrator Networking Plug-in
系列文
OpenStack-多到數不清的套件改36
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言